Internet Engineering Task Force (IETF) defines packet formats for multiple protocols, such as Session Initial Protocol (SIP) by an Augmented Backus-Naur Form (ABNF). When implementing the protocols, packets are required to be parsed according to their ABNF specifications.
The ABNF is a format syntax defined by the IETF in RFC2234. The ABNF is a modified version of Backus-Naur Form (BNF). The difference between the ABNF and the BNF includes: naming rules, repetition, alternatives, order-independence and value ranges.
At present, an ABNF parser is usually implemented on a universal micro-processor by software to perform a morphology and syntax parsing algorithm, e.g., an LL (1) syntax parsing algorithm within a compiling principle domain. The LL (1) syntax parsing algorithm is a superincumbent non-recursive prediction analyzer. The LL (1) syntax parsing algorithm constructs a prediction analyzing table of the syntax by computing a First Terminals Set and a Follow Terminals Set of the syntax, so as to make a deduction according to the prediction analyzing table. The LL (1) syntax is an unambiguous syntax without left recursion. The first “L” of the LL (1) represents to scan an input string from left to right; the second “L” represents to generate a most left deduction; “1” represents to refer to one input symbol forward when determining each action of the ABNF parser.
Because the ABNF is a text-coded syntax definition, the complexity for the ABNF parser to parse a string with a variable-length is higher than that to parse binary data with a fixed-length. The advantage of the ABNF parser is that, the ABNF parser may be implemented with a lower cost and a higher efficiency. However, the universal micro-processor is not specifically designed for the ABNF parser. Therefore, processing speed, throughput and other performance parameters of the micro-processor are often limited. When a higher processing speed is required, for example, when an SIP soft-switch system needs to handle millions of connections, it is necessary to use a higher-level micro-processor. Thus, the cost of the ABNF parser is increased inevitably.
There exists another kind of ABNF parser which is also implemented on the universal micro-processor. For this kind of ABNF parser, specific software is designed in respect of features of an ABNF syntax rule within a specific domain. For example, as to the SIP, a usual implementation is to segment an SIP packet into several fields by a segmentation identifier according to the feature of the SIP syntax rule; then perform corresponding syntax rule check.
The second kind of ABNF parser is designed for a specific syntax rule, thus the efficiency is higher than that of the first kind of ABNF parser described above. However, the specific design of the second kind of ABNF parser also leads to a poor generality. As to a new syntax rule, the ABNF parser must be redesigned. Thus, the cost for developing the ABNF parser is increased and the developing efficiency is lowered. On the other hand, because the second kind of ABNF parser is still designed based on the universal micro-processor, the problem described in respect of the first kind of ABNF parser still exists when the high processing speed is required.